package com.asm.DBloader;

import android.content.ContentValues;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

public class ASM_fProvinceDS {
	private SQLiteDatabase dB;
	private ASM_DB dbHelper;
	Context context;
	
	
	public ASM_fProvinceDS(Context context) {
		this.context = context;
		dbHelper  = new ASM_DB(context);
		
	}
	
	public void open() throws SQLException
	{
		dB = dbHelper.getWritableDatabase();
	}
	
	public int Create(ASM_fProvince det) 
	{
		
		int count =0;
		
		if(dB == null){
			open();
		}else if(!dB.isOpen()){
			open();
		}
		
		
		ContentValues values = new ContentValues();
		
		values.put(ASM_DB.asmFProvince_ProvCode, det.getAsmFProvince_ProvCode());
		values.put(ASM_DB.asmFProvince_ProvName, det.getAsmFProvince_ProvName());
		values.put(ASM_DB.asmFProvince_CntryCode, det.getAsmFProvince_CntryCode());
		values.put(ASM_DB.asmFProvince_AddUser, det.getAsmFProvince_AddUser());
		values.put(ASM_DB.asmFProvince_AddMach, det.getAsmFProvince_AddMach());
	


		
		count = (int) dB.insert(ASM_DB.ASM_FPROVINCE, null, values);

		dB.close();
		return count;
		
	}
}
